package com.shoulei.designpattern.filterPattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName:CriteriaSingle
 * @Descrition:
 * @Author:shoulei
 * @Date:2019/4/14 11:11
 * @Verson:
 */
public class CriteriaSingle implements Criteria{
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> singles = new ArrayList<Person>();
        for(Person person : persons){
            if("single".equalsIgnoreCase(person.getMaritalStatus())){
                singles.add(person);
            }
        }
        return singles;
    }
}
